using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PETimer;

public class TimeSvc : ILogic
{
    private TickTimer mTimer;
    
    public int AddTask(uint delay, Action<int> taskCB, Action<int> cancelCB= null, int count = 1)
    {
        return mTimer.AddTask(delay, taskCB, cancelCB, count);
    }

    public bool DeleteTask(int tid)
    {
        return mTimer.DeleteTask(tid);
    }

    public void Init()
    {
        mTimer = new TickTimer(0, false);
        mTimer.LogFunc = this.Log;
        mTimer.WarnFunc = this.Warn;
        mTimer.ErrorFunc = this.Error;
    }

    public void Tick()
    {
       mTimer.UpdateTask();
    }

    public void UnInit()
    {
        this.Log("TimeSvc UnInit!");
    }
}